< previous page page_589 next page >

Page 589
z0609-01.gif
Figure 17.5
Ray tracing provides hidden surface removal.
by tracing a ray from each light source toward the surface or from the surface toward each light source. This ray is called a shadow feeler.
If the shadow feeler finds an object between a light source and the surface you are drawing, the light does not shine directly on the surface. In that case, the surface is in shadow and the pixel's color is due entirely to ambient light. This test even detects cases in which one part of an object shadows another part of the same object. For instance, when the light source is on the far side of a sphere, the far surface of the sphere shadows the near side.
Ray Tracing in Visual Basic
In practice, most programs do not really trace a ray until it reaches an object. Instead, they examine each object in the scene and find the point where the ray intersects the object. The program then picks the object for which the point of intersection is closest to the center of projection.
One way to do this is to think of the ray as a line segment starting at a point and extending along a vector. To trace a ray from the center of projection through a pixel on the screen,
z0609-02.gif
Figure 17.6
Ray tracing handles objects that pierce other objects.

 
< previous page page_589 next page >